package org.hongzhisoft.dis.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.hongzhisoft.dis.bean.Role;
import org.hongzhisoft.dis.service.RoleService;
import org.hongzhisoft.dis.service.impl.RoleServiceImpl;

/**
 * 角色查询处理类
 * @author LvhengChang
 *
 */
@WebServlet("/role/list")
public class RoleListServlet extends HttpServlet {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    private RoleService roleService = new RoleServiceImpl();
    
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        
        
        try {
            List<Role> roles = roleService.selectByAll();
            request.setAttribute("roles", roles);
            
            request.getRequestDispatcher("/roleList.jsp").forward(request, response);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        
    }
}
